package com.demo.mq.rabbitmq.callback;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;


/**
 * 消息的回调
 *
 * @author lee9213@163.com
 * @version 1.0
 * @date 2017-04-04 15:53
 */
public class RabbitMQCallback implements RabbitTemplate.ConfirmCallback {
    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        System.out.println("回调id：" + correlationData);
        if (ack) {
            System.out.println("消息消费成功");
        } else {
            System.out.println("消息消费失败：" + cause + "\n，重新发送");
        }
    }
}
